package com.woniuxy.carlife.carlifegateway.config;

import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.Arrays;
import java.util.List;

@Component
@Primary
public class ResourceProvider implements SwaggerResourcesProvider {
    @Override
    public List<SwaggerResource> get() {

        return Arrays.asList(
                createSwaggerResource("用户", "/users/v2/api-docs", "1.0"),
                createSwaggerResource("商品", "/product-server/v2/api-docs", "1.0"),
                createSwaggerResource("充电站", "/chargeds/v2/api-docs", "1.0"),
                createSwaggerResource("订单", "/order-server/v2/api-docs", "1.0"),
                createSwaggerResource("门店服务", "/service-server/v2/api-docs", "1.0"),
                createSwaggerResource("消息与投诉", "/newcomplaints/v2/api-docs", "1.0"),
                createSwaggerResource("门店", "/store-server/v2/api-docs", "1.0")

        );
    }

    private SwaggerResource createSwaggerResource(String name, String url, String version) {
        SwaggerResource swaggerResource = new SwaggerResource();

        swaggerResource.setName(name);
        swaggerResource.setUrl(url);
        swaggerResource.setSwaggerVersion(version);

        return swaggerResource;
    }
}
